package com.dianban.service.impl;


import com.dianban.dao.CardDao;
import com.dianban.entity.Card;
import com.dianban.service.CardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;


@Service
@Transactional(readOnly = true)
public class CardServiceImpl implements CardService {

    @Autowired
    private CardDao cardDao;

    @Override
    public Card findByCardNum(String cardNum) {
        Card card = cardDao.findByCardNum(cardNum);
        return card;
    }

    @Override
    @Transactional(readOnly = false)
    public void update(Long id, String status, Long userId, Date activationTime, String storeId) {
        cardDao.update(id, status, userId, activationTime, storeId);
    }

    @Override
    public List<Card> findList(Long userId, String storeId) {
        return cardDao.findList(userId, storeId);
    }


    @Override
    public Card findById(Long id) {
        return cardDao.findById(id);
    }

    @Override
    @Transactional(readOnly = false)
    public int updateVerify(Long id, Integer hasVerify) {
        return cardDao.updateVerify(id,hasVerify);
    }
}
